<cfcomponent output="false">
	<cfset $ = application.helpers />
	<cfset timeoutinminutes = application.sessionTimeout />
	
	<!--- --->
	
	<cffunction name="getSession" access="public" output="false" returntype="query">
		
		<cfset var local = {} />
		
		<cfquery name="local.getSession" datasource="#$.site.getVar('datasource')#">
			select
			hex(session.id) as id,
			user_id,
			now() as now,
			json,
			date_format(session.modified,'%m/%d/%Y %H:%i:%s') as modified
			from session
			where session.active = 1
			<!--- and session.ip = #$.database.string($.format.decrypt(cookie.clientKey))# --->
			and session.modified + interval #timeoutinminutes# minute > now()
			order by session.modified desc
			limit 1
		</cfquery>

		<cfreturn local.getSession />
		
	</cffunction>
	
	<!--- --->

</cfcomponent>